package com.caseProject.puremvc.mediator.gui
{
	public class ElementAssociation
	{
		private var _id:int;
		private var _element:Element;
		private var _transitions:Vector.<Transition>;
		
		public function ElementAssociation(element:Element, transition:Transition)
		{
			this._element = element;
			this._transitions = new Vector.<Transition>();
			this._transitions.push(transition);
		}
		
		public function addTransition(transition:Transition):void
		{
			this._transitions.push(transition);
		}
		
		public function removeTransition(transition:Transition):void
		{
			var index:int = this._transitions.indexOf(transition);
			
			if (index != -1)
			{
				this._transitions.splice(index,1);
			} else {
				throw new Error ("ElementAssociation: Transition not found.");
			}
		}
		
		public function get transitions():Vector.<Transition>
		{
			return _transitions.concat(); //retorna a cópia do vetor
		}

		public function get element():Element
		{
			return _element;
		}

		public function get id():int
		{
			return _id;
		}

		public function set id(value:int):void
		{
			_id = value;
		}
	}
}